package com.bawei.base.role.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bawei.base.role.mapper.RoleMapper;
import com.bawei.base.role.model.Role;
import com.bawei.base.role.model.RoleExample;
import com.bawei.base.role.service.RoleService;

@Service
public class RoleServiceImpl implements RoleService {

	@Resource
	private RoleMapper roleMapper;

	public void addRole(Role role) {
		roleMapper.insert(role);
	}

	public void updateRole(Role role) {
		roleMapper.updateByPrimaryKey(role);
	}

	public void deleteRole(Long id) {
		roleMapper.deleteByPrimaryKey(id);
	}

	public List<Role> getRole() {
		return roleMapper.selectByExample(new RoleExample());
	}

	public Role getRoleById(Long id) {
		return roleMapper.selectByPrimaryKey(id);
	}
}
